/*
package com.lmy.order.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
import org.springframework.web.bind.annotation.RestController;

import java.io.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

*/
/**
 * @author lmy
 * @description: TODO
 * @date 2024/5/15 14:50
 *//*

@Slf4j
@RestController
public class AddSqlController {


    public static void main(String[] args) {
        try {
            FileInputStream file = new FileInputStream("C:\\Users\\liu706656193\\Desktop\\11111.xls");
            Workbook workbook = WorkbookFactory.create(file);
            Sheet sheet = workbook.getSheetAt(0); // 假设数据在第一个sheet中

            //生成的sql存放路径
            String filePath = "C:\\Users\\liu706656193\\Desktop\\批量生成sql.txt";
            //存放生成的sql语句的集合
            ArrayList<String> sqlList = new ArrayList<>();

            for (Row row : sheet) {
               */
/* Cell cell1 = row.getCell(0); // 数据1列
                Cell cell2 = row.getCell(1); // 数据2列*//*

                Cell cell1 = row.getCell(3);
                if (cell1 != null) {
                    String data1 = getDataFromCell(cell1);

                    String sql = "update AD_EPIBOLY_WORKER_RESUME SET AD_EPIBOLY_WORKER_RESUME.QUALIFICATION_FLAG = " +
                            "(SELECT A1.ORG_ID from AD_EPIBOLY_WORKER_RESUME A1 wehre A1.IS_DELETE = '0' and" +
                            " A1.ID_CARD_NO ='" + data1 + "') where IS_DELETE = '0' and ID_CARD_NO = '" + data1 + "';";
                    sqlList.add(sql);
                    System.out.println(sql); // 输出生成的SQL语句
                }
            }
            workbook.close();
            file.close();
            fileWrite(filePath, sqlList);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InvalidFormatException e) {
            throw new RuntimeException(e);
        }
    }

    private static String getDataFromCell(Cell cell) {
      */
/*  switch (cell.getCellType()) {
            case STRING:
                return cell.getStringCellValue();
            case NUMERIC:
                return String.valueOf(cell.getNumericCellValue());
            case BOOLEAN:
                return String.valueOf(cell.getBooleanCellValue());
            default:
                return "";
        }*//*



        String cellValue = null;
        // 以下是判断数据的类型
        switch (cell.getCellType()) {
            case HSSFCell.CELL_TYPE_NUMERIC: // 数字
                DecimalFormat df = new DecimalFormat("0");
                cellValue = df.format(cell.getNumericCellValue());
                break;
            case HSSFCell.CELL_TYPE_STRING: // 字符串
                cellValue = cell.getStringCellValue();
                break;
            case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
                cellValue = cell.getBooleanCellValue() + "";
                break;
            case HSSFCell.CELL_TYPE_FORMULA: // 公式
                cellValue = cell.getCellFormula() + "";
                break;
            case HSSFCell.CELL_TYPE_BLANK: // 空值
                cellValue = "";
                break;
            case HSSFCell.CELL_TYPE_ERROR: // 故障
                cellValue = null;
                break;
            default:
                cellValue = null;
                break;
        }
        return cellValue;

    }

    private static void fileWrite(String filePath, List<String> sqlList) {
        //创建一个文件
        File file = new File(filePath);
        OutputStream out = null;
        try {
            //打开文件输出流
            out = new FileOutputStream(file);
            for (int i = 0; i < sqlList.size(); i++) {
                //读取输出流中的字节
                byte[] bytes = (sqlList.get(i)+"\r\n").getBytes();
                //写入文件
                out.write(bytes);
            }
            log.info("写文件" + file.getAbsolutePath() + "成功！");
        } catch (IOException e) {
            log.error("写文件" + file.getAbsolutePath() + "失败！", e);
        } finally {
            if (out != null) {
                try {
                    //关闭输出文件流
                    out.close();
                } catch (IOException e) {
                    log.error("写文件" + file.getAbsolutePath() + "失败！", e);
                }
            }
        }
    }

}
*/
